package com.czy.configclient.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author czy
 * @create 2018-04-17 1:13
 **/
@RestController
//加了@RefreshScope的类,可以通过/refresh端点来刷新配置
@RefreshScope
public class ConfigClientController
{
	//注入的值,是git仓库,label分支,配置文件中的profile的值
	@Value("${profile}")
	private String profile;

	@GetMapping("/profile")
	public String getProfile()
	{
		return this.profile;
	}
}
